package com.wing.bill.controller.app;

import com.wing.bill.service.DayAndMonthReportForAppService;
import com.wing.common.utils.JsonResult;
import com.wing.common.utils.PageResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

@Validated
@Api(value = "App-刀具柜日报表月报表", tags = "#/bill/dayAndMonth")
@RestController("dayAndMonthReportForAppController")
@RequestMapping("bill/app/dayAndMonthReportForApp")
@RequiredArgsConstructor
public class DayAndMonthReportForAppController {
    private final DayAndMonthReportForAppService dayAndMonthReportForAppService;

    @ApiOperation(value = "小程序顶部数据领新", notes = "搜索")
    @GetMapping("/list")
    public JsonResult list(@RequestParam("type")String type){
        HashMap map = dayAndMonthReportForAppService.queryTopNew(type);
        return JsonResult.success("查询成功",map);
    }

    @ApiOperation(value = "小程序顶部数据工单", notes = "搜索")
    @GetMapping("/topOrder")
    public JsonResult queryTopOrder(@RequestParam("type")String type){
        HashMap map = dayAndMonthReportForAppService.queryTopOrder(type);
        return JsonResult.success("查询成功",map);
    }

    @ApiOperation(value = "小程序顶部数据存入", notes = "搜索")
    @GetMapping("/topIn")
    public JsonResult queryTopIn(@RequestParam("type")String type){
        HashMap map = dayAndMonthReportForAppService.queryTopIn(type);
        return JsonResult.success("查询成功",map);
    }

    @ApiOperation(value = "小程序顶部数据四小块", notes = "搜索")
    @GetMapping("/topCell")
    public JsonResult queryTopCell(@RequestParam("type")String type){
        HashMap map  = dayAndMonthReportForAppService.queryTopCell(type);
        return JsonResult.success("查询成功",map);
    }

    @ApiOperation(value = "小程序顶部数据异常原因占比", notes = "搜索")
    @GetMapping("/topUnusualReason")
    public PageResult queryTopUnusualReason(@RequestParam("type")String type, @RequestParam("page")int page, @RequestParam("size")int size){
        return dayAndMonthReportForAppService.queryTopUnusualReason(type,page,size);
    }

    @ApiOperation(value = "小程序员工领新", notes = "搜索")
    @GetMapping("/employeeNew")
    public PageResult queryEmployeeNew(@RequestParam("type")String type,@RequestParam("page")int page,@RequestParam("size")int size){
        return dayAndMonthReportForAppService.queryEmployeeNew(type,page,size);
    }

    @ApiOperation(value = "小程序员工领新总数量", notes = "搜索")
    @GetMapping("/employeeNewNum")
    public JsonResult queryEmployeeNewNum(@RequestParam("type")String type){
        HashMap map = new HashMap();
        map.put("value",dayAndMonthReportForAppService.queryEmployeeNewNum(type));
        return JsonResult.success("查询成功",map);
    }

    @ApiOperation(value = "小程序工单用料", notes = "搜索")
    @GetMapping("/orderMat")
    public PageResult queryOrderMat(@RequestParam("type")String type,@RequestParam("page")int page,@RequestParam("size")int size){
        return dayAndMonthReportForAppService.queryOrderMat(type,page,size);
    }

    @ApiOperation(value = "小程序机床用料", notes = "搜索")
    @GetMapping("/deviceMat")
    public PageResult queryDeviceMat(@RequestParam("type")String type,@RequestParam("param")String param,@RequestParam("page")int page,@RequestParam("size")int size){//type 时间 param qua数量money金额
        return dayAndMonthReportForAppService.queryDeviceMat(type,param,page,size);
    }

    @ApiOperation(value = "小程序换刀时间", notes = "搜索")
    @GetMapping("/changeTool")
    public PageResult queryChangeTool(@RequestParam("type")String type,@RequestParam("page")int page,@RequestParam("size")int size){
        return dayAndMonthReportForAppService.queryChangeTool(type,page,size);
    }

    @ApiOperation(value = "小程序换刀时间平均值", notes = "搜索")
    @GetMapping("/changeToolAvg")
    public JsonResult queryChangeToolAvg(@RequestParam("type")String type){
        HashMap map = new HashMap();
        map.put("value",dayAndMonthReportForAppService.queryChangeToolAvg(type));
        return JsonResult.success("查询成功",map);
    }

    @ApiOperation(value = "小程序归还率", notes = "搜索")
    @GetMapping("/returnRatio")
    public PageResult queryReturnRatio(@RequestParam("page")int page,@RequestParam("size")int size){
        return dayAndMonthReportForAppService.queryReturnRatio(page,size);
    }

    @ApiOperation(value = "小程序未归还", notes = "搜索")
    @GetMapping("/noReturn")
    public PageResult queryNoReturn(@RequestParam("page")int page,@RequestParam("size")int size){
        return dayAndMonthReportForAppService.queryNoReturn(page,size);
    }
    @ApiOperation(value = "小程序未归还总价值", notes = "搜索")
    @GetMapping("/noReturnTotal")
    public JsonResult queryNoReturn(){
        HashMap map = new HashMap();
        map.put("value",dayAndMonthReportForAppService.queryNoReturnTotal());
        return JsonResult.success("查询成功",map);
    }

    @ApiOperation(value = "小程序员工报失数量", notes = "搜索")
    @GetMapping("/employeeLoss")
    public PageResult queryEmployeeLoss(@RequestParam("page")int page,@RequestParam("size")int size){
        return dayAndMonthReportForAppService.queryEmployeeLoss(page,size);
    }

    @ApiOperation(value = "小程序用刀分担成本", notes = "搜索")
    @GetMapping("/toolCost")
    public PageResult queryToolCost(@RequestParam("page")int page,@RequestParam("size")int size){
        return dayAndMonthReportForAppService.queryToolCost(page,size);
    }

    @ApiOperation(value = "小程序用刀分担成本平均值", notes = "搜索")
    @GetMapping("/toolCostAvg")
    public JsonResult queryToolCostAvg(){
        HashMap map = new HashMap();
        map.put("value",dayAndMonthReportForAppService.queryToolCostAvg());
        return JsonResult.success("查询成功",map);
    }

    @ApiOperation(value = "小程序用刀寿命", notes = "搜索")
    @GetMapping("/lifeSpan")
    public PageResult queryLifeSpan(@RequestParam("page")int page,@RequestParam("size")int size){
        return dayAndMonthReportForAppService.queryLifeSpan(page,size);
    }

    @ApiOperation(value = "小程序用刀寿命平均线", notes = "搜索")
    @GetMapping("/lifeSpanAvg")
    public JsonResult queryLifeSpanAvg(){
        HashMap map = new HashMap();
        map.put("value",dayAndMonthReportForAppService.queryLifeSpanAvg());
        return JsonResult.success("查询成功",map);
    }

    @ApiOperation(value = "小程序公司人数", notes = "搜索")
    @GetMapping("/numOfEmp")
    public JsonResult queryNumOfEmp(){
        HashMap map = new HashMap();
        map.put("value",dayAndMonthReportForAppService.queryNumOfEmp());
        return JsonResult.success("查询成功",map);
    }
}
